package com.huawei.appgallery.wishlist.ui.cardkit.card;

import android.content.Context;
import android.graphics.Paint;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.text.style.TypefaceSpan;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import o.azb;
import o.cgz;
import o.chy;
import o.ckl;
import o.ckl.c;
import o.dce.a;
import o.dce.e;
import o.dce.j;
import o.ddg;
import o.epv;

public class WishEmptyCardV2 extends BaseDistCard {
    private int ʼ = 200;
    private TextView ˋ;

    public WishEmptyCardV2(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        this.ˋ = (TextView) view.findViewById(e.ˉॱ);
        LayoutParams layoutParams = (LayoutParams) ((LinearLayout) view.findViewById(e.ˊʻ)).getLayoutParams();
        if (layoutParams == null) {
            layoutParams = new LayoutParams(-1, -2);
        }
        layoutParams.height = epv.ˋ(view.getContext(), this.ʼ);
        ʽ(view);
        return this;
    }

    private void ˎ(chy o_chy) {
        String string = this.ʼॱ.getString(j.ʽॱ);
        String string2 = this.ʼॱ.getString(j.ˋॱ);
        CharSequence spannableString = new SpannableString(this.ʼॱ.getString(j.ᐝ, new Object[]{string, string2}));
        Paint paint = new Paint();
        paint.setTextSize(this.ˋ.getTextSize());
        if (paint.measureText(spannableString.toString()) > ((float) ((azb.ॱ(this.ʼॱ) - azb.ˊ(this.ʼॱ)) - azb.ˏ(this.ʼॱ)))) {
            string2 = "\n" + this.ʼॱ.getString(j.ˋॱ);
            spannableString = new SpannableString(this.ʼॱ.getString(j.ᐝ, new Object[]{string, string2}));
        }
        int indexOf = spannableString.toString().indexOf(string);
        int indexOf2 = spannableString.toString().indexOf(string2);
        ckl o_ckl = new ckl(this.ʼॱ);
        o_ckl.ˏ(new ddg(o_chy, 10, this));
        spannableString.setSpan(new ForegroundColorSpan(this.ʼॱ.getResources().getColor(a.ˏ)), indexOf, string.length() + indexOf, 33);
        spannableString.setSpan(new TypefaceSpan(this.ʼॱ.getResources().getString(j.ˎ)), indexOf, string.length() + indexOf, 33);
        spannableString.setSpan(o_ckl, indexOf, string.length() + indexOf, 33);
        ckl o_ckl2 = new ckl(this.ʼॱ);
        o_ckl2.ˏ(new ddg(o_chy, 12, this));
        spannableString.setSpan(new ForegroundColorSpan(this.ʼॱ.getResources().getColor(a.ˏ)), indexOf2, string2.length() + indexOf2, 33);
        spannableString.setSpan(new TypefaceSpan(this.ʼॱ.getResources().getString(j.ˎ)), indexOf2, string2.length() + indexOf2, 33);
        spannableString.setSpan(o_ckl2, indexOf2, string2.length() + indexOf2, 33);
        this.ˋ.setText(spannableString);
        this.ˋ.setMovementMethod(new c());
        this.ˋ.setHighlightColor(0);
    }

    public void ॱ(chy o_chy) {
        if (o_chy != null) {
            ˎ(o_chy);
        }
    }
}
